<template>
  <div>
    <div class="common_form_search">
      <el-form
        ref="searchForm"
        :inline="true"
        :model="searchForm"
      >
        <el-form-item label="保险余额">
          <el-input
            v-model="policy_money"
            disabled
          />
        </el-form-item>
        <!-- <el-form-item>
          <el-button
            size="small"
            type="primary"
            @click="search()"
          >查询</el-button>
          <el-button
            size="small"
            @click="reset()"
          >重置</el-button>
          <el-button
            size="small"
            @click="setRiskValue()"
          >修改风控区间</el-button>
        </el-form-item>
      </el-form> -->
      </el-form></div>
    <!-- <el-divider /> -->
    <!-- <div class="flex align-center table-top-btns">
      <h5 class="flex align-center">
        <svg-icon
          style="margin-right:15px"
          icon-class="list"
          :size="15"
        />数据列表
      </h5>
    </div>
    <el-table
      :data="tableData"
      border
    >
      <el-table-column
        align="center"
        prop="id"
        width="60"
        label="ID"
      />
      <el-table-column
        align="center"
        width="190"
        label="订单编号"
      >
        <template slot-scope="scope">
          <span
            class="blue-font pointer"
            @click="goToOrder(scope.row.trade_no)"
          >{{ scope.row.trade_no }}</span>
        </template>
      </el-table-column>
      <el-table-column
        align="center"
        prop="user_name"
        label="用户名"
      />
      <el-table-column
        align="center"
        prop="user_idcard"
        label="用户身份证号"
      />
      <el-table-column
        align="center"
        prop="user_mobile"
        label="用户手机号"
      />
      <el-table-column
        align="center"
        prop="shopname"
        label="供应商名称"
      />
      <el-table-column
        align="center"
        prop="risk_report_url"
        width="150"
        label="报告地址"
      >
        <template slot-scope="scope">
          <span
            class="blue-font pointer"
            @click="checkUrl(scope.row)"
          >查看报告</span>
        </template>
      </el-table-column>
      <el-table-column
        align="center"
        prop="create_time"
        label="查询时间"
      />
    </el-table>
    <custom-page
      ref="customPage"
      :total="total"
      @getList="getList"
    />
    <chechUrl-dialog
      ref="chechUrlDialog"
      :select-row="selectRow"
      @getList="getList"
    /> -->
    <!--  -->
    <!-- <el-dialog title="风控区间修改" :visible.sync="dialogVisible" width="500px">
      <el-form :model="returnForm">
        <el-form-item label="区间最小值" label-width="120px">
          <el-input
            v-model="valueForm.min"
            autocomplete="off"
            placeholder="请输入最小值"
            type="number"
            maxlength="5"
            show-word-limit
          />
        </el-form-item>
        <el-form-item label="区间最大值" label-width="120px">
          <el-input
            v-model="valueForm.max"
            autocomplete="off"
            placeholder="请输入最大值"
            type="number"
            maxlength="5"
            show-word-limit
          />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="confirmVisible">确 定</el-button>
      </div>
    </el-dialog> -->
  </div>
</template>

<script>
// import myDatePicker from '@/components/myDatePicker'
// import customPage from '@/components/customPage'
import { getPolicy } from '@/api/data'
// import chechUrlDialog from '@/components/chechUrl'
export default {
  // components: { myDatePicker, customPage, chechUrlDialog },
  data() {
    return {
      searchForm: {
        order_id: '',
        create_time: '',
        user_mobile: '',
        user_name: ''
      },
      valueForm: {
        min: 0,
        max: 0
      },
      tableData: [],
      total: 0,
      selectRow: null,
      dialogVisible: false,
      returnForm: {},

      policy_money: 0
    }
  },
  mounted() {
    this.getList()
  },
  methods: {
    checkUrl(row) {
      this.selectRow = row
      this.$refs.chechUrlDialog.dialogVisible = true
      // if (url) {
      //   window.open(url)
      // } else {
      //   this.$message.warning('暂无可查看报告')
      //   return
      // }
    },
    goToOrder(orderId) {
      if (orderId) {
        this.$router.push({ name: 'orderList', params: { orderId }})
      }
    },
    // 查询
    search() {
      const pickerVal = this.$refs.myDatePicker.getVal()
      if (pickerVal !== 'error') {
        this.searchForm.create_time = pickerVal
        this.$refs.customPage.page = 1
        this.getList()
      }
    },
    // 重置
    reset() {
      if (this.$refs.myDatePicker) {
        this.$refs.myDatePicker.reset()
      }
      this.searchForm = {
        order_id: '',
        create_time: '',
        user_mobile: '',
        user_name: ''
      }
      this.getList()
    },
    changeNumberInput(value) {
      const pattern = /^[1-9][0-9]*$/
      if (!pattern.test(value)) {
        // input 框绑定的内容为空
        this.searchForm.order_id = ''
      }
    },
    getList() {
      // const { page, pageSize } = this.$refs.customPage
      getPolicy().then(res => {
        const { str } = res
        this.policy_money = str
      })
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
